using System;
using System.Collections.Generic;
using System.Text;
using UIProcessService;

namespace UIProcessServiceHost
{
    using System;
    using System.ServiceModel;

    // A WCF service consists of a contract (defined below), 
    // a class which implements that interface, and configuration 
    // entries that specify behaviors and endpoints associated with 
    // that implementation (see <system.serviceModel> in your application
    // configuration file).

    public class MyServiceHost
    {
        internal static ServiceHost myServiceHost = null;

        public static void StartService()
        {
            //Consider putting the baseAddress in the configuration system
            //and getting it here with AppSettings
            Uri baseAddress = new Uri("http://localhost:8080/UIProcessService");

            //Instantiate new ServiceHost 
            //myServiceHost = new ServiceHost(typeof(UIProcessService.theService), baseAddress);

            //Open myServiceHost
            myServiceHost.Open();
        }

        public static void StopService()
        {
            //Call StopService from your shutdown logic (i.e. dispose method)
            if (myServiceHost.State != CommunicationState.Closed)
                myServiceHost.Close();
        }
    }
}
